#include<sys/types.h>
#include<sys/ipc.h>
#include<sys/msg.h>
#include<stdio.h>
#include<stdlib.h>


int main()
{
    key_t mykey;
    if((mykey = ftok(".",100)) == -1)
    {
        perror("fail to ftok");
        exit(-1);
    }

    int my_msqid = 0;
    if((my_msqid = msgget(mykey,IPC_CREAT|0666)) == -1)
    {
        perror("fail to msgget");
        exit(-1);
    }

    //删除my_msqid唯一标识的消息队列
    if(msgctl(my_msqid,IPC_RMID,NULL))
    {
        perror("fail to IPC_RMID");
        exit(-1);
    }
    return 0;
}